// 验证数据库中用户相关的内容


const user ={
    // 查询用户手机号
    queryUserTel(option){
        return 'select * from user where tel ='+option.userTel+''
    },
     // 查询密码
     queryUserPwd(option){
        return 'select * from user where (tel ='+option.userTel+') and pwd ='+option.userPwd+''
    },
    // 新增用户
    inserdata(option){
        let userTel = option.userTel
        // 引入token包
        let jwt=require('jsonwebtoken')
        // 用户信息
        let payload={tel:userTel}
        // 口令
        let secret ='xiaoluxian'
        // 生成token
        let token =jwt.sign(payload,secret)
        return 'insert into user (tel,pwd,imgUrl,nickName,token) values("'+userTel+'","123456","1.jpg","用户昵称","'+token+'")'
    },
    // 注册用户
    register(option){
        let userTel = option.userTel
        let passWord = option.passWord
        // 引入token包
        let jwt=require('jsonwebtoken')
        // 用户信息
        let payload={tel:userTel}
        // 口令
        let secret ='xiaoluxian'
        // 生成token
        let token =jwt.sign(payload,secret,{
            expiresIn:60
        })
        let tokenObj=jwt.decode(token)
        console.log(tokenObj);



        return 'insert into user (tel,pwd,imgUrl,nickName,token) values("'+userTel+'","'+passWord+'","1.jpg","用户昵称","'+token+'")'
    }

    
    
}

exports =module.exports=user